<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- AUTHOR: JOEY -->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <f:facet name="first">
            <meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
            <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
            <meta http-equiv="Cache-Control" content="no-cache" />
            <meta http-equiv="Pragma" content="no-cache" />
            <title><ui:insert name="title">LiveLab-Create Student</ui:insert></title>
        </f:facet>
        <title>LiveLab-Create Student</title>
        <style type="text/css">
            h1{
                color:darkblue;
            }
            blockquote{
                font-size:12px;
            }
            .ui-widget, .ui-widget .ui-widget {
                font-size: 90% !important;
            }
            body{
                font-size: 12px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="form">
            <h1>Java LiveLab Student Registration</h1>
            <h:panelGrid>
                
                <h:panelGroup>
                <h:outputText   value="Signup Code:"/>
                <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{studentRegisterBean.student.signupCode}" id="signupCode" required="true" requiredMessage="Signup code is required" validator="#{studentRegisterBean.validateSignupCode}" />
                <p:message for="signupCode" />
                
                <h:panelGroup>
                <h:outputText   value="Username(e.g, firstNameLastName):" />
                <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{studentRegisterBean.student.userName}" id="username" required="true" requiredMessage="Username is required" validator="#{studentRegisterBean.validateUsername}" />
                <p:message for="username"/>
                
                <h:panelGroup>
                <h:outputText   value="Password:" />
                <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:password    value="#{studentRegisterBean.student.password}" binding="#{studentRegisterBean.passInput}" id="password" required="true" requiredMessage="Password is required" validatorMessage ="Password should be of length from 1 to 100" feedback="false">
                    <f:validateLength minimum="1" maximum="100" for="password"/>
                </p:password>
                <p:message for="password"/>
                
                <h:outputText   value="Confirm Password:" />
                <p:password    value="#{studentRegisterBean.confirmPassword}" feedback="false"  binding="#{studentRegisterBean.confPassInput}" id="confirmPassword" required="true" requiredMessage="Confirm Password is required" validator="#{studentRegisterBean.validatePassword}"/>
                <p:message for="confirmPassword"/>
                
                <h:panelGroup>
                <h:outputText   value="Course ID (e.g., NYUCS123Fall2013):" />
                <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{studentRegisterBean.student.courseId}" binding="#{studentRegisterBean.courseIdInput}" id="courseId" required="true" requiredMessage="Course id is required" validator="#{studentRegisterBean.validateCourseId}">
                    <f:validateLength minimum="1" maximum="100" for="courseId"/>
                </p:inputText>
                <p:message for="courseId"/>
                
                <h:panelGroup>
                <h:outputText   value="Student First Name:" />
                <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{studentRegisterBean.student.firstName}" id="studentFirstName" required="true" requiredMessage="First name is required" validatorMessage ="First name should be of length from 1 to 100">
                    <f:validateLength minimum="1" maximum="100" for="studentFirstName"/>
                </p:inputText>
                <p:message for="studentFirstName"/>
                
                <h:panelGroup>
                <h:outputText   value="Student Last Name:" />
                <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{studentRegisterBean.student.lastName}" id="studentLastName" required="true" requiredMessage="Course id is required" validatorMessage ="Last name should be of length from 1 to 100">
                    <f:validateLength minimum="1" maximum="100" for="studentLastName"/>
                </p:inputText>
                <p:message for="studentLastName"/>
                
                <h:panelGroup>
                <h:outputText   value="Student Email:" />
                <h:outputText   value="*" style="color: red" />
                </h:panelGroup>
                <p:inputText    value="#{studentRegisterBean.student.email}" id="studentEmail" required="true" requiredMessage="Email is required" validator ="#{studentRegisterBean.validateEmailAddress}" />
                <p:message for="studentEmail"/>
                
                <h:outputText   value="Student Major:"/>
                <p:inputText    value="#{studentRegisterBean.student.major}" id="studentMajor" validatorMessage ="Student Major should be of length from 0 to 50">
                    <f:validateLength maximum="50" for="studentMajor"/>
                </p:inputText>
                <p:message for="studentMajor"/>
                
            </h:panelGrid>
            
            <p:commandButton value="Register Student" process="@form" update="@form" action="#{studentRegisterBean.registerStudent}"/>
        </h:form>
    </h:body>
</html>

